Page({
  data: {
    collect: [],
    tabs: [
      {
        id: 0,
        title: '商品收藏',
        isActive: true
      },
      {
        id: 1,
        title: '品牌收藏',
        isActive: false
      },
      {
        id: 2,
        title: '店铺收藏',
        isActive: false
      },
      {
        id: 3,
        title: '浏览足迹',
        isActive: false
      },
    ]
  },
  onShow() {
    this.pageInit()
  },
  pageInit() {
    let collect = wx.getStorageSync('collect') || [];
    this.setData({collect})
  },
  handleTabClick(e) {
    let id = e.detail.id;
    let {tabs} = this.data;
    tabs.forEach((v, i) => v.isActive = i === id ?  true : false);
    this.setData({tabs});
  }
})